<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <title>while实现1到100相加求和</title>
</head>
<body>
    <script>
        var i =1;
        var result =0;
         while (i<=100){
            result += i;
            console.log(i);
           
            i++
        } 
        console.log('相加和:' + result);
    </script>
</body>
</html>